toWindowInsetsCompat

Wrap an instance of WindowInsets into a WindowInsetsCompat.

This version of the function does not allow the resulting WindowInsetsCompat to be aware of the root window insets and root view, meaning that the returned values for many of the different inset Types will be incorrect.

Prefer using toWindowInsetsCompat instead.

Return

the wrapped instance

Parameters

insets

source insets to wrap


Wrap an instance of WindowInsets into a WindowInsetsCompat.

This version of the function allows the resulting WindowInsetsCompat to be aware of the root window insets and root view through the view parameter. This is required for many of the different inset Types to return correct values when used on devices running Android 10 and before.

Return

the wrapped instance

Parameters

insets

source insets to wrap

view

view to use as an entry point for obtaining root window information. This view needs be attached to the window, otherwise it will be ignored.